<?php
namespace app\index\controller;

use think\Db;
use think\Controller;
use think\Session;
use pmhapp\Pmhapp;
use pmhapp\Curl;

/**
 * 验证权限 2021/12/12 23:15
 * 
 * 作者qq 32579135
 * 官网：https://pmhapp.com
**/

class Base extends controller
{
    public function _initialize(){
        
        $this->_user = session('user');
        
        if(!$this->_user){
			header('Location: /login');
			exit;
		}
		
		$user = Db::name('user')->where(['id'=>$this->_user['id']])->find();
		$time = time();
		if ($user['expire_time'] <= $time && $user['expire_time']) {
		   	header('Location: /msg.html');
			exit;
		}
		
		$this->userId = $this->_user['id'];
		$this->userName = $this->_user['username'];
		$this->pmhapp = new Pmhapp;
		
		//导航栏
		
    }
}